import React from "react";
import * as PropTypes from "prop-types";
import Unit from "./Unit";

export default class Menu extends React.Component
{
    /**
     * 默认属性
     */
    static defaultProps =
    {
        items : []
    };

    /**
     * 属性类型
     */
    static propTypes =
    {
        items : PropTypes.arrayOf(PropTypes.object)
    };

    render ()
    {
        return <div className="menu-fold">
            {this.props.items.map((unit, index)=><Unit icon={unit.icon} title={unit.title} active={unit.active} items={unit.items} key={index}/>)}
        </div>
    }
}